home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1992 June: ROMin Holiday / ADC Developer CD (1992-06) (''ROMin Holiday'')_iso / Developer Connection - 06-1992.iso / Developer Essentials / MPW Interfaces & Libraries / PInterfaces / Events.p < prev    next >
Encoding:
Text File  |  1992-01-29  |  2.8 KB  |  139 lines  |  [TEXT/MPS ]

  1.  
  2. {
  3. Created: Sunday, September 15, 1991 at 10:40 PM
  4.  Events.p
  5.  Pascal Interface to the Macintosh Libraries
  6.  
  7.   Copyright Apple Computer, Inc. 1985-1991
  8.   All rights reserved
  9. }
  10.  
  11.  
  12. {$IFC UNDEFINED UsingIncludes}
  13. {$SETC UsingIncludes := 0}
  14. {$ENDC}
  15.  
  16. {$IFC NOT UsingIncludes}
  17.  UNIT Events;
  18.  INTERFACE
  19. {$ENDC}
  20.  
  21. {$IFC UNDEFINED UsingEvents}
  22. {$SETC UsingEvents := 1}
  23.  
  24. {$I+}
  25. {$SETC EventsIncludes := UsingIncludes}
  26. {$SETC UsingIncludes := 1}
  27. {$IFC UNDEFINED UsingTypes}
  28. {$I $$Shell(PInterfaces)Types.p}
  29. {$ENDC}
  30. {$IFC UNDEFINED UsingQuickdraw}
  31. {$I $$Shell(PInterfaces)Quickdraw.p}
  32. {$ENDC}
  33. {$SETC UsingIncludes := EventsIncludes}
  34.  
  35. CONST
  36. nullEvent = 0;
  37. mouseDown = 1;
  38. mouseUp = 2;
  39. keyDown = 3;
  40. keyUp = 4;
  41. autoKey = 5;
  42. updateEvt = 6;
  43. diskEvt = 7;
  44. activateEvt = 8;
  45. osEvt = 15;
  46.  
  47. { event mask equates }
  48. mDownMask = 2;
  49. mUpMask = 4;
  50. keyDownMask = 8;
  51. keyUpMask = 16;
  52. autoKeyMask = 32;
  53. updateMask = 64;
  54. diskMask = 128;
  55. activMask = 256;
  56. highLevelEventMask = 1024;
  57. osMask = -32768;
  58. everyEvent = -1;
  59.  
  60. { event message equates }
  61. charCodeMask = $000000FF;
  62. keyCodeMask = $0000FF00;
  63. adbAddrMask = $00FF0000;
  64. osEvtMessageMask = $FF000000;
  65.  
  66. { OS event messages.  Event (sub)code is in the high byte of the message field. }
  67. mouseMovedMessage = $FA;
  68. suspendResumeMessage = $01;
  69.  
  70. resumeFlag = 1;                { Bit 0 of message indicates resume vs suspend }
  71. convertClipboardFlag = 2;    { Bit 1 in resume message indicates clipboard change }
  72.  
  73. { modifiers }
  74. activeFlag = 1;                { Bit 0 of modifiers for activateEvt and mouseDown events }
  75. btnState = 128;                { Bit 7 of low byte is mouse button state }
  76. cmdKey = 256;                { Bit 0 }
  77. shiftKey = 512;                { Bit 1 }
  78. alphaLock = 1024;            { Bit 2 }
  79. optionKey = 2048;            { Bit 3 of high byte }
  80. controlKey = 4096;
  81.  
  82. { obsolete equates }
  83. networkEvt = 10;
  84. driverEvt = 11;
  85. app1Evt = 12;
  86. app2Evt = 13;
  87. app3Evt = 14;
  88. app4Evt = 15;
  89. networkMask = 1024;
  90. driverMask = 2048;
  91. app1Mask = 4096;
  92. app2Mask = 8192;
  93. app3Mask = 16384;
  94. app4Mask = -32768;
  95.  
  96. TYPE
  97. EventRecord = RECORD
  98.  what: INTEGER;
  99.  message: LONGINT;
  100.  when: LONGINT;
  101.  where: Point;
  102.  modifiers: INTEGER;
  103.  END;
  104.  
  105.  
  106. KeyMap = PACKED ARRAY [0..127] OF BOOLEAN;
  107.  
  108. FUNCTION GetNextEvent(eventMask: INTEGER;VAR theEvent: EventRecord): BOOLEAN;
  109.  INLINE $A970;
  110. FUNCTION WaitNextEvent(eventMask: INTEGER;VAR theEvent: EventRecord;sleep: LONGINT;
  111.  mouseRgn: RgnHandle): BOOLEAN;
  112.  INLINE $A860;
  113. FUNCTION EventAvail(eventMask: INTEGER;VAR theEvent: EventRecord): BOOLEAN;
  114.  INLINE $A971;
  115. PROCEDURE GetMouse(VAR mouseLoc: Point);
  116.  INLINE $A972;
  117. FUNCTION Button: BOOLEAN;
  118.  INLINE $A974;
  119. FUNCTION StillDown: BOOLEAN;
  120.  INLINE $A973;
  121. FUNCTION WaitMouseUp: BOOLEAN;
  122.  INLINE $A977;
  123. PROCEDURE GetKeys(VAR theKeys: KeyMap);
  124.  INLINE $A976;
  125. FUNCTION TickCount: LONGINT;
  126.  INLINE $A975;
  127. FUNCTION GetDblTime: LONGINT;
  128.  INLINE $2EB8,$02F0;
  129. FUNCTION GetCaretTime: LONGINT;
  130.  INLINE $2EB8,$02F4;
  131.  
  132.  
  133. {$ENDC} { UsingEvents }
  134.  
  135. {$IFC NOT UsingIncludes}
  136.  END.
  137. {$ENDC}
  138.  
  139.